//存入数据
import React from "react";
import CrowdFundingForm from "@/components/CrowdFundingForm";
import type { FieldType } from "@/tool/type";
import { message } from "antd"; // 新增

const App: React.FC = () => {
  const handleFinish = (values: FieldType) => {
    const list = JSON.parse(localStorage.getItem("crowdFundingList") || "[]");
    const newItem = {
      ...values,
      id: Date.now() + Math.random().toString(16).slice(2),
    };
    list.push(newItem);
    localStorage.setItem("crowdFundingList", JSON.stringify(list));
    message.success("存入成功！"); // 新增提示
    console.log("Success:", newItem);
  };

  return <CrowdFundingForm onFinish={handleFinish} submitText="存入" />;
};

export default App;
